<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
        <style>
        .hint {
            font-size: 12px;
            color: #f00;
        }
        .input {
            height: 50px;
        }
        .input label {
            display: inline-block;
            text-align: right;
            width: 100px;
        }
        .button {
            margin-top: 30px;
        }
        #captcha {
            vertical-align: middle;
        }
    </style>
</head>
<body>
    <h1>用户注册</h1>
    <hr>
    <p class="hint">{{ hint }}</p>
    <form action="/register/" method="post">
        {% csrf_token %}
        <div class="input">
            <label>用户名：</label>
            <input type="text" name="username" required>
        </div>
        <div class="input">
            <label>密码：</label>
            <input type="password" name="password" required>
        </div>
        <div class="input">
            <label>确认密码：</label>
            <input type="password" name="repassword" required>
        </div>
        <div class="input">
            <label>邮箱：</label>
            <input type="email" name="email" required>
        </div>
        <div class="input">
            <label>手机号：</label>
            <input type="tel" name="tel" required>
            <input type="button" id="send" value="获取验证码">
        </div>
        <div class="input">
            <label>手机验证码：</label>
            <input type="text" name="code" required>
        </div>
        <div>
            <input type="checkbox" name="agreement">
            <span>网站<a href="">服务条款</a></span>
        </div>
        <div class="button">
            <input type="submit" value="注册">
            <input type="reset" value="重置">
        </div>
    </form>
    <p>
        <a href="/">返回首页</a>
        <a href="/login/">返回登录</a>
    </p>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script>
        $(() => {
            $('#send').on('click', (evt) => {
                let tel = $('input[type=tel]').val().trim()
                $.getJSON('/mobile/?tel=' + tel, (json) => {
                    alert(json.hint)
                })
            })
        })
    </script>
</body>
</html>